﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="发货明细.aspx.cs" Inherits="syc.ZhiJian.Report.发货明细" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title></title>
    <script type="text/javascript" language="javascript" src="/common.js"></script>
    <script src="../jquery.js" type="text/javascript"></script>
    <script type="text/javascript" language="javascript" >

        //PAGE_LOAD()
        $(document).ready(function() {
            //截止日期默认取当天
            $('#Date1').change(function() {
                if ($('#Date2').val() == "") {
                    $('#Date2').val($('#Date1').val());
                }
            });
            //清空两个日期框
            $('#clear').click(function() {
                $('#Date1').val("");
                $('#Date2').val("");
            });
        });						
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
            <div class="hooo">
        <div id="wintop" class="wintop">发货<span lang="zh-cn"><u>明细</u></span></div>
        <asp:Panel ID="Panel1" runat="server" CssClass="panel" Height="36px">
  
        <table>
        <tr id="row2" runat="server">
        <td>         
        <span style="width:220px;text-align:right;">
            起始日期：<asp:TextBox ID="Date1" runat="server" CssClass="intxt1" Width="120px" AutoPostBack="true"></asp:TextBox><img alt="" src="/Icons/29.png" align="middle" onclick="makecalendar(document.getElementById('Date1').value, document.getElementById('Date1'));" />
        </span>
        </td>
        
        <td>
        <span style="width:220px;text-align:right;">
            截止日期：<asp:TextBox ID="Date2" runat="server" CssClass="intxt1" Width="120px" AutoPostBack="true"></asp:TextBox><img alt="" src="/Icons/29.png" align="middle" onclick="makecalendar(document.getElementById('Date2').value, document.getElementById('Date2'));" />
        </span>
        <input type="button" class="smallbutton" id="clear" value="清空日期"/>
        </td>
       
        <td>
        &nbsp;&nbsp;产品:
        </td>
        <td>
<asp:SqlDataSource ID="DS_ChanPin" runat="server" 
    ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>" 
    SelectCommand="SELECT [ID],[品名]+' '+[钢级]+' '+[规格] AS 名称 FROM [产品]"></asp:SqlDataSource>
        <asp:DropDownList ID="DList_Produce" runat="server" AutoPostBack="True" 
                onselectedindexchanged="DList_month_SelectedIndexChanged" Width="150px" 
                Font-Size="12px" DataSourceID="DS_ChanPin" DataTextField="名称" DataValueField="ID">
        </asp:DropDownList>
        </td>
       <td>&nbsp;&nbsp;&nbsp;<asp:Button ID="Query" runat="server" CssClass="button" Text="生成报表" onclick="Query_Click" /></td>
        <td><asp:Button ID="Button1" runat="server" CssClass="button" Text="导出" onclick="Button1_Click" /></td>
        </tr>
        </table>

        </asp:Panel>
        <asp:Panel ID="Panel2" runat="server" CssClass="panel2">
        <asp:Label ID="Message" runat="server" Text="·准备就绪" CssClass="prompt" Visible="True"></asp:Label>
        </asp:Panel> 
    
        <h1 style="text-align: center;">    
            <%=Date1.Text%>到<%=Date2.Text%><%=DList_Produce.SelectedItem.Text %>发货明细</h1>
        <div align="center">    
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
            DataSourceID="SqlDataSource1" style="text-align: center" BorderColor="Black" 
                BorderStyle="Solid" BorderWidth="2px">
                 <RowStyle Height="40px" />
                 <HeaderStyle Height="40px" />
            <Columns>
                <asp:BoundField DataField="日期" HeaderText="日期" 
                    SortExpression="日期" DataFormatString="{0:d}" ItemStyle-Width="100"/>
                <asp:BoundField DataField="名称" HeaderText="名称" 
                    SortExpression="名称" ItemStyle-Width="50" />
                <asp:BoundField DataField="品名" HeaderText="品名" 
                    SortExpression="品名" DataFormatString="" ItemStyle-Width="60"/>
                <asp:BoundField DataField="车数" HeaderText="车数" 
                    SortExpression="车数" ReadOnly="True" ItemStyle-Width="100"/>
                <asp:BoundField DataField="捆数" HeaderText="捆数" 
                    SortExpression="捆数" ReadOnly="True" ItemStyle-Width="100"/>
                <asp:BoundField DataField="支数" HeaderText="支数" 
                    SortExpression="支数" ReadOnly="True" ItemStyle-Width="100"/>
                <asp:BoundField DataField="总重量" HeaderText="总重量(Kg)" ReadOnly="True" 
                    SortExpression="总重量" ItemStyle-Width="100"/>
                <asp:BoundField DataField="重量" HeaderText="总重量(吨)" ReadOnly="True" 
                    SortExpression="重量" ItemStyle-Width="100"/>
                <asp:BoundField DataField="总长度" HeaderText="总长度" ReadOnly="True" 
                    SortExpression="总长度" ItemStyle-Width="100"/>
            </Columns>
        </asp:GridView>
        </div>
    
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>" 
            SelectCommand="SELECT dbo.产品出库单.日期, dbo.产品订货单位.名称, 
       dbo.产品.品名, COUNT(*) AS 车数, 
       SUM(dbo.产品出库单.总件数) AS 捆数, 
       SUM(dbo.产品出库单.总支数) AS 支数, 
       SUM(dbo.产品出库单.总重量) AS 总重量, 
       SUM(ROUND(dbo.产品出库单.总重量/1000,3)) AS 重量, 
       SUM(dbo.产品出库单.总长度) AS 总长度
FROM   dbo.产品出库单 INNER JOIN
       dbo.产品销售合同 ON dbo.产品出库单.合同ID = dbo.产品销售合同.ID INNER JOIN
       dbo.产品订货单位 ON dbo.产品销售合同.订货单位ID = dbo.产品订货单位.ID INNER JOIN
       dbo.产品 ON dbo.产品出库单.产品类别ID = dbo.产品.ID
GROUP BY dbo.产品出库单.日期, dbo.产品订货单位.名称, dbo.产品.品名"></asp:SqlDataSource>
    
    </div>
    </form>
</body>
</html>
